package pack0831;
//第二种实现方式，实现Runnable接口
public class DemoC {
    public static void main(String[] args) {
        DemoC1 dc1 = new DemoC1();
        Thread t1 = new Thread(dc1);
        t1.start();

        DemoC2 dc2 = new DemoC2();
        Thread t2 = new Thread(dc2);
        t2.start();
    }
}
class DemoC1 implements Runnable{
    @Override
    public void run() {
        System.out.println("我是线程"+Thread.currentThread().getName());
    }
}
class DemoC2 implements Runnable{
    @Override
    public void run() {
        System.out.println("我是线程"+Thread.currentThread().getName());
    }
}
